home *** CD-ROM | disk | FTP | other *** search
- /*
- * This routine turns pacing on/off and gets a pace character
- * Author:Jerry LeVan
- * 325 Boone Trail
- * Richmond Ky 40475
- *
- * New File: Sep 23,1987
- */
-
- #include <quickdraw.h>
- #include <controls.h>
- #include <dialogs.h>
-
- #define PACEID 5088 /* dialog number */
- #define PACECHECK 3 /* item number for checkbox */
- #define PACECHAR 4 /* item number for edit item for pace char */
- #define PACEDELAY 6 /* item number for delay field */
- #define OK 1 /* item number for OK button */
-
- #define __SEG__ Pacing
-
- void DoPaceDialog(theChar,doPacing,theDelay)
- char *theChar; /* current choice */
- Boolean *doPacing; /* true implies do line pacing */
- long *theDelay; /* number of ticks to delay between characters */
-
- { DialogPtr theWindow;
- Rect Box;
- short type,item;
- GrafPtr savePort;
- Handle ckHandle; /* handle to check item */
- Handle chHandle; /* handle to pace character item */
- Handle aHandle; /* for ok button */
- Handle deHandle; /* handle for delay field */
- char aString[10]; /* storage for pace character ,delay string */
-
- GetPort(&savePort);
-
- /* get the dialog (created invisible) */
- theWindow = (DialogPtr)GetNewDialog(PACEID,0,(Ptr)-1);
- SetPort(theWindow);
-
- /* set the current prompt character and pacing state */
-
- /* first set the check box with the appropriate value */
- GetDItem(theWindow,PACECHECK,&type,&ckHandle,&Box);
- SetCtlValue((ControlHandle)ckHandle,*doPacing);
-
- /* Now set the pace character */
- GetDItem(theWindow,PACECHAR,&type,&chHandle,&Box);
- aString[0] = *theChar;
- aString[1] = (char)0;
- SetIText(chHandle,aString);
- SelIText(theWindow,PACECHAR,0,32767);
-
- /* set the delay amount field */
- NumToString(*theDelay,aString);
- GetDItem(theWindow,PACEDELAY,&type,&deHandle,&Box);
- SetIText(deHandle,aString);
-
- /* outline the OK button */
- GetDItem(theWindow,OK,&type,&aHandle,&Box);
- PenSize(3,3);
- InsetRect(&Box,-4,-4);
- FrameRoundRect(&Box,16,16);
- PenSize(1,1);
-
- /* show the window */
- ShowWindow(theWindow);
-
- /* now we can do the dialog */
- do
- { ModalDialog(0,&item);
- if(item == PACECHECK){
- /* invert the value */
- *doPacing = !(*doPacing);
- SetCtlValue((ControlHandle)ckHandle,*doPacing);
- }
- }
- while(item!=OK);
-
- /* return the info left in the dialog */
-
- GetIText(chHandle,aString);
- *theChar = aString[0]; /* the pace character */
-
- GetIText(deHandle,aString);
- StringToNum(aString,theDelay);
-
- /* clean up and return */
- DisposDialog(theWindow);
- SetPort(savePort);
- }